<?php
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use yii\widgets\LinkPager;
use yii\grid\GridView;
use yii\helpers\Url;
use yii\jui\DatePicker;
$this->title = '当前门店团餐';
?>
<?= Html::jsFile('./assets/order/laydate/laydate.js')?>
<?= Html::cssFile('./assets/order/lab.css')?>
<?= Html::cssFile('./assets/order/xia.css')?>
<?= Html::jsFile('./assets/order/layer.js')?> 
<script>
$(document).ready(function(){

	$('.menu').on('click',function(){
		var id = $(this).attr('id');
		$('#menu'+id).show();
        //计算总价

	})

				
				
})
</script>


<div class="widget-box">
  <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
    <h5>门店团餐</h5>
  </div>
        <?php if(isset($data)): ?>
            <?php foreach($data as $model): ?>
                <a href="javascript:void(0)" class="menu" id="<?= Html::encode($model['menu_id']) ?>"><?= Html::encode($model['menu_name']) ?></a>
            <?php endforeach; ?>
        <?php endif; ?>
  <div class="widget-content nopadding">
    <table class="table table-bordered data-table" style="overflow:scroll; font-size:12px;">
        <tr>
            <th>菜品名</th>
            <th>单价</th>
            <th>折扣</th>
            <th>数量</th>
            <th>小计</th>
        </tr>
        <tbody>
            <input id="shop_id" type="hidden" value="<?= Html::encode($shop_id) ?>">
            <?php if(isset($data)): ?>
                <?php foreach($data as $model): ?>
                    <tr id="menu<?= Html::encode($model['menu_id']) ?>" style="display:none">
                        <input type="hidden" value="<?= Html::encode($menu_id) ?>">
                        <td><?= Html::encode($model['menu_name']) ?></td>
                        <td><input type="text" value="<?= Html::encode($model['menu_price']) ?>" style="padding: 0px 0px 0px 7px; width: 100px; height: 30px; margin-bottom: 0px;"></td>
                        <td><input type="text" value="1" style="padding: 0px 0px 0px 7px; width: 100px; height: 30px; margin-bottom: 0px;"></td>
                        <td><input type="text" value="0" style="padding: 0px 0px 0px 7px; width: 100px; height: 30px; margin-bottom: 0px;"></td>
                        <td><?= Html::encode($model['menu_price']) ?></td>
                    </tr>
                <?php endforeach; ?>
                    <tr>
                        <td colspan="2">总计：￥ <span id='price'>0.00</span></td>
                        <td colspan="2"><button class="btn btn-inverse sub">团购点餐</button></td>
                    </tr>
            <?php endif; ?>
        </tbody>
    </table>
  </div>
</div>